package com.example.lib_base.net

import com.example.lib_base.entity.*
import okhttp3.RequestBody
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query

interface ApiService {

    @POST("/api/user/login")
    suspend fun login(@Query("username")username:String,@Query("password")password:String): Res<LoginEntity>

    @POST("/api/user/register")
    suspend fun register(@Query("username")username:String,@Query("password")password:String):Res<LoginEntity>

    @GET("/api/announcements")
    suspend fun getNotice(@Query("page")page:Int,@Query("size")size:Int):Res<NoticeEntityResult>

    @GET("/api/news")
    suspend fun getNews():Res<NewsEntity>

    //车位管理
    @GET("/api/parking-spaces/type/{spaceType}")
    suspend fun getCarType(@Path("spaceType")spaceType:String):Res<CarTypeEntity>

    //车位状态
    @GET("/api/parking-spaces/status/{spaceStatus}")
    suspend fun getstatus(@Path("spaceStatus")spaceStatus:String):Res<CarTypeEntity>

    //车位id
    @GET("/api/parking-spaces/area/{areaId}")
    suspend fun getId(@Path("areaId")areaId:Int):Res<CarTypeEntity>

    //添加车位
    @POST("/api/parking-spaces")
    suspend fun addPark(@Body body: RequestBody):Res<AddParkEntity>

    //修改车位
    @PUT("/api/parking-spaces/{id}")
    suspend fun XiuPark(@Path("id")id:Int,@Body body: RequestBody):Res<CarTypeEntity>

    //访客记录
    @GET("/api/visit-appointments")
    suspend fun getView():Res<ViewEntity>

    @GET("/api/visit-appointments/search/name")
    suspend fun searchName(@Query("name")name:String):Res<ViewEntity>


    //保修工单
    @GET("/api/repair-orders")
    suspend fun getRepair():Res<RepairOrderEntity>
}